package com.example.blog.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author ly
 * @since 2023-08-03
 */
@Data
public class Comment implements Serializable {

    @TableField(exist = false)
    private User user;

    private static final long serialVersionUID = 1L;

      @TableId(value = "id", type = IdType.AUTO)
      private Integer id;

      /**
     * 文章Id
     */
      @TableField("articleId")
      private Integer articleId;

      /**
     * 评论内容
     */
      @NotBlank(message = "请提交评论内容!")
      @Pattern(regexp = ".{1,100}", message = "评论的内容必须是1~100字符")
      private String content;

      /**
     * 评论人Id
     */
      @TableField("createBy")
      private Integer createBy;

      /**
     * 评论时间
     */
      @TableField("createTime")
      private LocalDateTime createTime;

    
    public Integer getId() {
        return id;
    }

      public void setId(Integer id) {
          this.id = id;
      }
    
    public Integer getArticleId() {
        return articleId;
    }

      public void setArticleId(Integer articleId) {
          this.articleId = articleId;
      }
    
    public String getContent() {
        return content;
    }

      public void setContent(String content) {
          this.content = content;
      }
    
    public Integer getCreateBy() {
        return createBy;
    }

      public void setCreateBy(Integer createBy) {
          this.createBy = createBy;
      }
    
    public LocalDateTime getCreateTime() {
        return createTime;
    }

      public void setCreateTime(LocalDateTime createTime) {
          this.createTime = createTime;
      }

    @Override
    public String toString() {
        return "Comment{" +
              "id=" + id +
                  ", articleId=" + articleId +
                  ", content=" + content +
                  ", createBy=" + createBy +
                  ", createTime=" + createTime +
              "}";
    }
}
